package com.into.common.csv.converters;

import com.into.common.csv.CSVConverter;

public class FloatConverter implements CSVConverter<Float> {

	@Override
	public Float fromString(String value) throws Exception {
		if (value == null || value.length() == 0)
			return 0F;
		if (value.indexOf(",") != -1)
			return Float.parseFloat(value.replace(",", "."));
		else
			return Float.parseFloat(value);
	}

	@Override
	public String toString(Float value) throws Exception {
		return value.toString();
	}

}
